home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 9 / FM Towns Free Software Collection 9.iso / t_os / shell / igo / gosource / kifuctrl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-16  |  16.5 KB  |  795 lines

  1. #define DEBUG 0
  2. /* 
  3.     TOWNS囲碁棋譜記録プログラム
  4.                                           1992/02/25  久保田俊也
  5.  
  6.     91/02/25  kifuctrl モジュールを本体より分離 
  7.                 kifuデ-タを操作する関数の集まり 
  8.  
  9. */
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include "igo.h"
  14. #include "banx.h"
  15. #include "kiffile.h"
  16. #include "kifuctrl.h"
  17. #include "title.h"
  18. #include "print.h"
  19.  
  20. #define HEAD -1 /* ichiが-1の場合HEADとする */
  21. #define SPACE20 "                    "
  22.  
  23. char *comment_read(int comment_no);
  24. TE *cell_get();
  25. TE_ARG cell_read();
  26.  
  27. static TE *current_te;
  28. static TE *head;
  29. static char ban[MAX_BANSIZE2];
  30. static BAN_TYPE ban_type;
  31. static int bansize;
  32. static int bansize2;
  33.  
  34. static int  numberdisp_flg = 1;    /* 手順表示する 0以外 しない 0 */
  35. static int  repeat_flg = 0;        /* リピ-トする 0以外 しない 0 */
  36. static int  change_flg = 0;     /* 変化再生する 0以外 しない 0 */
  37. static int  comment_flg = 1;    /* コメント表示する 0以外 しない 0 */
  38. static int    save_rebirth_speed = 0;
  39.  
  40.  
  41. int kifu_init()
  42. {
  43. int i;
  44.  
  45. /* bansize等ここでは使わないが他のモジュ-ルで使用 */
  46.     ban_type = *title_bantype_read();
  47.     if( ban_type.type == NORMAL){
  48.         bansize = ban_type.size;
  49.         bansize2 = (bansize+1)*(bansize+2)+1;
  50.     }
  51.  
  52.     cell_init();
  53.     head = cell_get();
  54.  
  55.     comment_init();
  56.     ban_init(ban);
  57.     banx_init();
  58.  
  59.     head->iro = WHITE;
  60.     for(i=0;i<bansize2;i++){
  61.         head->ban[i] = ban[i];
  62.     }
  63.     head->brother = head;
  64.     head->prev    = head;
  65.     head->next    = head;
  66.     head->ichi    = HEAD;     /* headの判定使用*/
  67.     head->black_capture_number = 0;
  68.     head->white_capture_number = 0;
  69.  
  70.     current_te   = head;
  71.     return 0;
  72. }
  73.  
  74. int kifu_end()
  75. {
  76.  
  77.     return    banx_end();
  78.  
  79. }
  80.  
  81. int kifu_put(int ichi)
  82. {
  83. int i, uchiage_number;
  84. TE *add_te;
  85. TE *temp;
  86.  
  87.     if(ban[ichi]==BLACK || ban[ichi]==WHITE){
  88.         return 0;
  89.     }
  90.  
  91.     if(current_te->next->iro == DELETE){
  92.         add_te = current_te->next;
  93.     }else{
  94.         add_te = cell_get();
  95.         if(add_te == NULL){
  96.             printf("return of cell_get() = null!\n");
  97.             return 1;
  98.         }
  99.         add_te->comment = 0;
  100.         /*  次の手に兄弟がない */
  101.         if(current_te->next == current_te->next->brother){
  102.             add_te->brother = add_te;
  103.         /*  次の手が枝の頭ではない */
  104.         }else if(current_te->next->ichi != HEAD){
  105.             add_te->brother = current_te->next->brother;
  106.             for(temp=current_te->next;
  107.                 temp->brother != current_te->next;
  108.                 temp=temp->brother){
  109.                 ;
  110.             }
  111.             current_te->next->brother = temp->brother;
  112.             temp->brother = add_te;
  113.         /*  次の手が枝の頭で かつ 一番下の弟である */
  114.         }else if(current_te->next->brother->ichi != HEAD ||
  115.                  current_te->next->brother == head){
  116.             add_te->brother = add_te;
  117.         /*  次の手が枝の頭で かつ 下に弟がいる */
  118.         }else{
  119.             add_te->brother = current_te->next->brother;
  120.             for(temp=current_te->next;
  121.                 temp->brother->ichi == HEAD && temp->brother != head;
  122.                 temp=temp->brother){
  123.                 ;
  124.             }
  125.             current_te->next->brother = temp->brother;
  126.             temp->brother = add_te;
  127.         }
  128.         
  129.         add_te->prev = current_te;
  130.         add_te->next = current_te->next;
  131.         current_te->next->prev = add_te;
  132.         current_te->next       = add_te;
  133.     }
  134.  
  135.     ban[ichi] = 1 - current_te->iro;
  136.     banx_uchiage( ban, ichi, &uchiage_number);
  137.     Debugprint2("uchiga_number = %d\n", uchiage_number);
  138.     
  139.     add_te->ichi = ichi;
  140.     add_te->iro  = 1 - current_te->iro;
  141.     for(i=0;i<bansize2;i++){
  142.         add_te->ban[i] = ban[i];
  143.     }
  144.     if(add_te->iro == BLACK){
  145.         add_te->black_capture_number = current_te->black_capture_number + uchiage_number;
  146.         add_te->white_capture_number = current_te->white_capture_number;
  147.     }else{
  148.         add_te->black_capture_number = current_te->black_capture_number;
  149.         add_te->white_capture_number = current_te->white_capture_number + uchiage_number;
  150.     }
  151.  
  152.     
  153.     current_te = add_te;
  154.     return 0;
  155.  
  156. }
  157.  
  158. int kifu_cancel()
  159. {
  160. int i;
  161. TE *save_te;
  162.  
  163.     if(current_te->ichi == HEAD || current_te->iro == DELETE){
  164.         return -1;
  165.     }
  166.  
  167.     if(current_te->brother != current_te || current_te->comment != 0){
  168.         current_te->iro = DELETE;
  169.         current_te = current_te->prev;
  170.     }else{
  171.         current_te->prev->next = current_te->next;
  172.         current_te->next->prev = current_te->prev;
  173.         save_te = current_te->prev;
  174.         cell_free(current_te);
  175.         current_te = save_te;
  176.     }
  177.     
  178.     for(i=0;i<bansize2;i++){
  179.         ban[i] = current_te->ban[i];
  180.     }
  181.     return 0;
  182. }
  183.  
  184. int kifu_forward()
  185. {
  186. int i, uchiage_number;
  187. TE *wk_te;
  188. TE *save_te;
  189.  
  190.     save_te = current_te;
  191.     do{
  192.         current_te = current_te->next;
  193.         if( change_flg != 0){
  194.             if(current_te != current_te->brother){
  195.                 current_te = current_te->brother;
  196.             }
  197.         }
  198.     }while(current_te->iro==DELETE);
  199.     
  200.     if(current_te->ichi==HEAD){
  201.         if(repeat_flg == 0 && change_flg == 0){
  202.             current_te = save_te;
  203.             return REPEAT_CANNOT_BOTTOM_CELL;
  204.         }
  205.         
  206.         if(current_te==head){
  207.             if(repeat_flg == 0){
  208.                 current_te = save_te;
  209.                 return REPEAT_CANNOT_BOTTOM_CELL;
  210.             }
  211.         
  212.             for(i=0;i<bansize2;i++){
  213.                 ban[i] = current_te->ban[i];
  214.             }
  215.             return HEAD_CELL;
  216.         }else{
  217.             for(i=0;i<bansize2;i++){
  218.                 if(change_flg == 0){
  219.                     ban[i] = current_te->ban[i];
  220.                 }else{
  221.                     current_te->ban[i] = ban[i];
  222.                     current_te->black_capture_number = save_te->black_capture_number;
  223.                     current_te->white_capture_number = save_te->white_capture_number;
  224.                 }
  225.             }
  226.             return BOTTOM_CELL;
  227.         }
  228.     }else{
  229.         /* 打ち上げ処理を行うために前の画面に戻る */
  230.         for(wk_te=current_te->prev;wk_te->iro==DELETE;wk_te=wk_te->prev){
  231.             ;
  232.         }
  233.         for(i=0;i<bansize2;i++){
  234.             ban[i] = wk_te->ban[i];
  235.         }
  236.         
  237.         ban[current_te->ichi] = current_te->iro;
  238.         banx_uchiage( ban, current_te->ichi, &uchiage_number);
  239.         if(current_te->iro == BLACK){
  240.             current_te->black_capture_number = wk_te->black_capture_number + uchiage_number;
  241.             current_te->white_capture_number = wk_te->white_capture_number;
  242.         }else{
  243.             current_te->black_capture_number = wk_te->black_capture_number;
  244.             current_te->white_capture_number = wk_te->white_capture_number + uchiage_number;
  245.         }
  246.         for(i=0;i<bansize2;i++){
  247.             current_te->ban[i] = ban[i];
  248.         }
  249.         return NORMAL_CELL;
  250.     }
  251.  
  252. }
  253.  
  254. int kifu_get_forwardinfo(int *ichi, char *iro)
  255. {
  256.  
  257. TE *wk_te;
  258.  
  259.     wk_te = current_te;
  260.     do{
  261.         wk_te = wk_te->next;
  262.         if( change_flg != 0){
  263.             if(wk_te != wk_te->brother){
  264.                 wk_te = wk_te->brother;
  265.             }
  266.         }
  267.     }while(wk_te->iro==DELETE);
  268.  
  269.     *ichi = wk_te->ichi;
  270.     *iro  = wk_te->iro;
  271.  
  272.     if(wk_te->ichi==HEAD){
  273.         if(repeat_flg == 0 && change_flg == 0){
  274.             return REPEAT_CANNOT_BOTTOM_CELL;
  275.         }
  276.         if(wk_te==head){
  277.             if(repeat_flg == 0){
  278.                 return REPEAT_CANNOT_BOTTOM_CELL;
  279.             }
  280.             return HEAD_CELL;
  281.         }else{
  282.             return BOTTOM_CELL;
  283.         }
  284.     }else{
  285.         return NORMAL_CELL;
  286.     }
  287.  
  288. }
  289.  
  290. int kifu_back()
  291. {
  292. int i;
  293. TE *wk_te;
  294.  
  295.     if(repeat_flg == 0 && change_flg == 0){
  296.         if(current_te->ichi == HEAD){
  297.             for(i=0;i<bansize2;i++){
  298.                 ban[i] = current_te->ban[i] ;
  299.             }
  300.             return 0;
  301.         }
  302.     
  303.     }else if(repeat_flg == 0 && change_flg != 0){
  304.         if(current_te == head){
  305.             for(i=0;i<bansize2;i++){
  306.                 ban[i] = current_te->ban[i] ;
  307.             }
  308.             return 0;
  309.         }
  310.     }
  311.     
  312.     do{
  313.         if(change_flg != 0){
  314.             if(current_te->brother!=current_te){
  315.                 for(wk_te=current_te;wk_te->brother!=current_te;wk_te=wk_te->brother){
  316.                     ;
  317.                 }
  318.                 current_te = wk_te;
  319.             }
  320.         }
  321.         current_te = current_te->prev;
  322.     }while(current_te->iro==DELETE);
  323.     
  324.     
  325.     for(i=0;i<bansize2;i++){
  326.         ban[i] = current_te->ban[i] ;
  327.     }
  328.  
  329.     return 0;
  330. }
  331.  
  332. int kifu_first()
  333. {
  334. int i;
  335.     
  336.     if(change_flg != 0){
  337.         current_te = head;
  338.         for(i=0;i<bansize2;i++){
  339.             ban[i] = head->ban[i] ;
  340.         }
  341.     }else{
  342.         for(current_te=current_te->next;current_te->ichi!=HEAD;current_te=current_te->next){
  343.             ;
  344.         }
  345.  
  346.         for(i=0;i<bansize2;i++){
  347.             ban[i] = current_te->ban[i];
  348.         }
  349.     }
  350.     return 0;
  351. }
  352.  
  353. int kifu_read(char fname[])
  354. {
  355. int i;
  356. int handy, te_number;
  357.  
  358. TE_ARG        kiffile_te2;
  359.  
  360.     if(kiffile_read(fname) == -1){
  361.         return -1;
  362.     }
  363.  
  364.     kifu_init(); /* ファイルリ-ドの後に実行 */
  365.     kiffile_comment_read();
  366.     ban_init(ban);
  367.     banx_init();
  368.     current_te = head;
  369.  
  370.     if((handy = title_handy_read()) != 0){
  371.         if(banx_handy_set( ban, handy)!=0){
  372.             return -1;
  373.         }
  374.         head->iro = BLACK;
  375.     }else{
  376.         head->iro = WHITE;
  377.     }
  378.     for(i=0;i<bansize2;i++){
  379.         head->ban[i] = ban[i];
  380.     }
  381.  
  382.     te_number= title_tenumber_read();
  383.     for(i=1;i <= te_number;i++){
  384.         kifte_read2(&kiffile_te2);
  385.         if(cell_write(kiffile_te2)== -1){
  386.             printf("cell_write error = %d!\n", te_number);
  387.             return -1;
  388.         }
  389.     }
  390.         
  391.     if(cell_write_finish()== -1){
  392.         printf("cell_write error = %d!\n", te_number);
  393.         return -1;
  394.     }
  395.         
  396.  
  397.     return 0;
  398. }
  399.  
  400. int kifu_write(char fname[])
  401. {
  402. TE_ARG      kiffile_te;
  403.  
  404.     kiftitle_write();
  405.  
  406.     kiffile_te = cell_read();
  407.     while(kiffile_te.no != -1){
  408.         kifte_write(kiffile_te);
  409.         kiffile_te = cell_read();
  410.     }
  411.     if(kiffile_write(fname) != 0){
  412.         return -1;
  413.     }
  414.     
  415.     return 0;
  416. }
  417.  
  418. int kifu_handy(int handy)
  419. {
  420. int i;
  421. BAN_TYPE ban_type;
  422.  
  423.     ban_type = *title_bantype_read();
  424.  
  425.     if( ban_type.type == NORMAL && ban_type.size == 19){
  426.         ;
  427.     }else{
  428.         return -1;
  429.     }
  430.  
  431.     kifu_init();
  432.     if(banx_handy_set( ban, handy ) == 0){
  433.         for(i=0;i<bansize2;i++){
  434.             head->ban[i] = ban[i];
  435.         }
  436.         title_handy_set(handy);
  437.         head->iro = BLACK;
  438.         current_te = head;
  439.         return 0;
  440.     }else{
  441.         return -1;
  442.     }
  443. }
  444.  
  445. int kifu_disp()
  446. {
  447. int i;
  448. TE *wk_te;
  449. int ex_ban[MAX_BANSIZE2];
  450.  
  451.     memset(ex_ban, 0, sizeof(ex_ban));
  452.  
  453.     if(title_judge_read() != 0){
  454.         disp_te(banx_judgedisp(), ex_ban);
  455.         return 0;
  456.     }
  457.     
  458.     if(numberdisp_flg != 0){
  459.         for(wk_te=current_te;wk_te->prev->ichi!=HEAD;wk_te=wk_te->prev){
  460.             ;
  461.         }
  462.         i=1;
  463.         for(;wk_te!=current_te->next;wk_te=wk_te->next){
  464.             if(wk_te->iro != DELETE){
  465.                 ex_ban[wk_te->ichi] = i;
  466.                 i++;
  467.             }
  468.         }
  469.     }
  470.     
  471.     disp_te(ban,ex_ban);
  472.     return 0;
  473. }
  474.  
  475. int kifu_numberdisp()
  476. {
  477.     numberdisp_flg = 1-numberdisp_flg;
  478.     return 0;
  479. }
  480.  
  481. int kifu_judge(int *b_territory_number, int *w_territory_number)
  482. {
  483.     banx_judge(ban);
  484.  
  485.     *b_territory_number=0;
  486.     *w_territory_number=0;
  487.  
  488.     banx_territory(b_territory_number, w_territory_number);
  489.     *b_territory_number += current_te->black_capture_number;
  490.     *w_territory_number += current_te->white_capture_number;
  491.  
  492.     return 0;
  493. }
  494.  
  495. int kifu_judgeput(int ichi, int *b_territory_number, int *w_territory_number)
  496. {
  497.  
  498.     banx_put(ichi);
  499.  
  500.     *b_territory_number=0;
  501.     *w_territory_number=0;
  502.  
  503.     banx_territory(b_territory_number, w_territory_number);
  504.     *b_territory_number += current_te->black_capture_number;
  505.     *w_territory_number += current_te->white_capture_number;
  506.  
  507.     return 0;
  508. }
  509.  
  510. int kifu_abandon()
  511. {
  512. int i;
  513. int comment_no;
  514. TE *add_te;
  515. TE *temp;
  516.  
  517.     if(current_te->next->iro == DELETE){
  518.         add_te = current_te->next;
  519.     }else{
  520.         add_te = cell_get();
  521.         if(add_te == NULL){
  522.             printf("return of cell_get() = null!\n");
  523.             return 1;
  524.         }
  525.         add_te->comment = 0;
  526.         /*  次の手に兄弟がない */
  527.         if(current_te->next == current_te->next->brother){
  528.             add_te->brother = add_te;
  529.         /*  次の手が枝の頭ではない */
  530.         }else if(current_te->next->ichi != HEAD){
  531.             add_te->brother = current_te->next->brother;
  532.             for(temp=current_te->next;
  533.                 temp->brother != current_te->next;
  534.                 temp=temp->brother){
  535.                 ;
  536.             }
  537.             current_te->next->brother = temp->brother;
  538.             temp->brother = add_te;
  539.         /*  次の手が枝の頭で かつ 一番下の弟である */
  540.         }else if(current_te->next->brother->ichi != HEAD ||
  541.                  current_te->next->brother == head){
  542.             add_te->brother = add_te;
  543.         /*  次の手が枝の頭で かつ 下に弟がいる */
  544.         }else{
  545.             add_te->brother = current_te->next->brother;
  546.             for(temp=current_te->next;
  547.                 temp->brother->ichi == HEAD && temp->brother != head;
  548.                 temp=temp->brother){
  549.                 ;
  550.             }
  551.             current_te->next->brother = temp->brother;
  552.             temp->brother = add_te;
  553.         }
  554.         
  555.         add_te->prev = current_te;
  556.         add_te->next = current_te->next;
  557.         add_te->black_capture_number = current_te->black_capture_number;
  558.         add_te->white_capture_number = current_te->white_capture_number;
  559.         current_te->next->prev = add_te;
  560.         current_te->next       = add_te;
  561.     }
  562.  
  563.     add_te->ichi = 0; /* 着手放棄の時設定 0正しい ? */
  564.     add_te->iro  = 1 - current_te->iro;
  565.     for(i=0;i<bansize2;i++){
  566.         add_te->ban[i] = ban[i];
  567.     }
  568.  
  569.     current_te = add_te;
  570.  
  571.     comment_no = comment_set("着手放棄");
  572.     current_te->comment = (short int)comment_no;
  573.  
  574.     return 0;
  575. }
  576.  
  577. int kifu_print(int start_te, int end_te, int out_start_te, int with_comment_id)
  578. {
  579. int i,j, uchiage_number;
  580. int x,y;
  581. int h_ichi;
  582. TE *wk_te;
  583. char print_ban[MAX_BANSIZE2];
  584. int ex_print_ban[MAX_BANSIZE2];
  585. char wstr[500];
  586. char wstr2[33];
  587.  
  588.     Debugprint("kifu_print start!\n");
  589.     wstr[0] = '\0';
  590.     for(i=0;i<bansize2;i++){
  591.         print_ban[i] = head->ban[i];
  592.         ex_print_ban[i] = 0;
  593.     }
  594.  
  595.     /* 最初の盤面を設定*/
  596.     /* 初期値の手が存在する事のチェックをどう行うか */
  597.     /* 画面より先の手を指定された場合の打ち上げ処理の実行 */
  598.     wk_te=head->next;
  599.     for(i=1;i<start_te;){
  600.         if(wk_te->next == head){
  601.             return -1; /* 初期値の手が存在しない */
  602.         }
  603.  
  604.         if(wk_te->iro != DELETE){
  605.             print_ban[wk_te->ichi] = wk_te->iro;
  606.             banx_uchiage( print_ban, wk_te->ichi, &uchiage_number);
  607.             i++;
  608.         }
  609.         wk_te=wk_te->next;
  610.     }
  611.  
  612.     Debugprint("kifu_print ban_setti ok !\n");
  613.     /* 手順の設定 */
  614.     j=out_start_te;
  615.     for(i=start_te;i<=end_te;i++){
  616.         if(wk_te->iro != DELETE){
  617.             if(wk_te->ichi == 0){
  618.                 sprintf(wstr2, "%d( 着手放棄 ) ", j);
  619.                 strcat(wstr, wstr2);
  620.             }else if(print_ban[wk_te->ichi] == BLANK){
  621.                 print_ban[wk_te->ichi] = wk_te->iro;
  622.                 ex_print_ban[wk_te->ichi] = j;
  623.             }else{
  624.             /* 盤外へ書き込む必要あり */
  625.                 if(ex_print_ban[wk_te->ichi] == 0){
  626.                     x = wk_te->ichi % (bansize + 1);
  627.                     y = wk_te->ichi / (bansize + 1);
  628.                     h_ichi = henkan_disp_in( x, y );
  629.                     x = h_ichi % (bansize + 1);
  630.                     y = h_ichi / (bansize + 1);
  631.                     sprintf(wstr2, "%d( %sの%s) ",
  632.                             j, my_itozenkaku(x), my_itozenkaku(y));
  633.                 }else{
  634.                     sprintf(wstr2, "%d( %d) ",
  635.                             j, ex_print_ban[wk_te->ichi]);
  636.                 }
  637.                 strcat(wstr, wstr2);
  638.             }
  639.             j++;
  640.         }
  641.         
  642.         if(wk_te->next == head){
  643.             i++; /*通常の場合は最終手にプラス1されるのでそれにあわす */
  644.             break;
  645.         }
  646.  
  647.         wk_te=wk_te->next;
  648.     }
  649.  
  650.     i--;
  651.     if(print_start()==0){
  652.         if(print_bangai( wstr, start_te, i /* 最後の手 */)==0){
  653.             if(print_te(print_ban,ex_print_ban)==0){
  654.                 print_exec();
  655.                 Debugprint("kifu_print end!\n");
  656.                 return 0;
  657.             }
  658.         }
  659.     }
  660.  
  661.     return -1;
  662.  
  663. }
  664.  
  665. int kifu_chg_put()
  666. {
  667. int i;
  668. TE *wk_te;
  669. TE *tmp_head;
  670.  
  671.     tmp_head = cell_get();
  672.     if(tmp_head == NULL){
  673.         return 1;
  674.     }
  675.  
  676.     tmp_head->iro   = current_te->iro;
  677.     tmp_head->ichi  = HEAD;
  678.     for(i=0;i<bansize2;i++){
  679.         tmp_head->ban[i] = ban[i];
  680.     }
  681.     for(wk_te = current_te->next;wk_te->brother !=wk_te;
  682.         wk_te = wk_te->brother->next){
  683.         ;
  684.     }
  685.     wk_te->brother    = tmp_head;
  686.     tmp_head->brother = wk_te;
  687.     tmp_head->prev    = tmp_head;
  688.     tmp_head->next    = tmp_head;
  689.     tmp_head->black_capture_number = current_te->black_capture_number;
  690.     tmp_head->white_capture_number = current_te->white_capture_number;
  691.     
  692.     current_te   = tmp_head;
  693.     
  694.     return 0;
  695. }
  696.  
  697. int kifu_chg_cancel()
  698. {
  699. int i;
  700. TE *wk_te;
  701.  
  702.     if(current_te != current_te->next || current_te == head){
  703.         for(current_te=current_te->prev;current_te->ichi!=HEAD;current_te=current_te->prev){
  704.             ;
  705.         }
  706.  
  707.         do{
  708.             if(current_te->brother!=current_te){
  709.                 for(wk_te=current_te;wk_te->brother!=current_te;wk_te=wk_te->brother){
  710.                     ;
  711.                 }
  712.                 current_te = wk_te;
  713.             }
  714.             current_te = current_te->prev;
  715.         }while(current_te->iro==DELETE);
  716.     
  717.         for(i=0;i<bansize2;i++){
  718.             ban[i] = current_te->ban[i];
  719.         }
  720.  
  721.         return 0;
  722.     }
  723.  
  724.     for(wk_te=current_te;wk_te->brother!=current_te;wk_te=wk_te->brother){
  725.         ;
  726.     }
  727.     wk_te->brother = current_te->brother;
  728.     cell_free(current_te);
  729.  
  730.     for(current_te=wk_te->prev;current_te->iro==DELETE;current_te=current_te->prev){
  731.         ;
  732.     }
  733.  
  734.     for(i=0;i<bansize2;i++){
  735.         ban[i] = current_te->ban[i];
  736.     }
  737.  
  738.     return 0;
  739. }
  740.  
  741. int kifu_rebirth( int repeat_flag, int change_flag, int comment_flag )
  742. {
  743.  
  744.     repeat_flg = repeat_flag;
  745.     change_flg = change_flag;
  746.     comment_flg = comment_flag;
  747.     return 0;
  748. }
  749.  
  750. /* 関数の作り方に問題あるかも知れないが取り合えず必要な物を作る */
  751. int kifu_chg_flg_set( int change_flag)
  752. {
  753. int w_flg;
  754.  
  755.     w_flg = change_flg;
  756.     change_flg = change_flag;
  757.     return w_flg;
  758. }
  759.  
  760. /* 関数の作り方に問題あるかも知れないが取り合えず必要な物を作る */
  761. int kifu_rebirth_speed_set( int rebirth_speed)
  762. {
  763. int w_speed;
  764.  
  765.     w_speed = save_rebirth_speed;
  766.     save_rebirth_speed = rebirth_speed;
  767.     return w_speed;
  768. }
  769.  
  770. int kifu_commentset(char *text)
  771. {
  772. int comment_no;
  773.  
  774.     comment_no = comment_set(text);
  775.     current_te->comment = (short int)comment_no;
  776.     return 0;
  777. }
  778.  
  779. char *kifu_commentread()
  780. {
  781.     
  782.     return comment_read((int)current_te->comment);
  783.  
  784. }
  785.  
  786. int kifu_captureread(int *black_capture_number, int *white_capture_number)
  787. {
  788.  
  789.     *black_capture_number = current_te->black_capture_number;
  790.     *white_capture_number = current_te->white_capture_number;
  791.     return 0;
  792.  
  793. }
  794.  
  795.